<?php $this->load->view('layout/header'); ?>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <h3 class="page-title">商品管理<small> 类别管理</small></h3>
            <?php echo breadcrumb(array('商品管理', 'tourismgoods/grid' => '商品列表', 'tourismgoodscategory/grid' => '类别管理')); ?>
        </div>
    </div>
    <?php echo execute_alert_message() ?>
    <div class="row-fluid">
        <div class="span12">
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption"><i class="icon-search"></i>搜索</div>
                    <div class="tools">
                        <a class="collapse" href="javascript:;"></a>
                        <a class="remove" href="javascript:;"></a>
                    </div>
                </div>
                <div class="portlet-body form">
                    <form class="form-horizontal form-search" action="<?php echo base_url('tourismgoodscategory/grid')?>" method="get">
                        <div class="row-fluid">
                            <div class="span6">
                                <div class="control-group">
                                    <label class="control-label">下级分类</label>
                                    <div class="controls">
                                        <?php $this->load->view('commonhtml/categorySelect1');?>
                                    </div>
                                </div>
                            </div>
                            <div class="span6">
                                <div class="control-group">
                                    <label class="control-label">类别名</label>
                                    <div class="controls">
                                        <input type="text" name="name" value="<?php echo $this->input->get('name');?>" class="m-wrap medium">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="span6">
                                <div class="control-group">
                                    <label class="control-label">级别</label>
                                    <div class="controls">
                                        <select class="medium m-wrap required" name="level">
                                            <option value="">请选择</option>
                                            <?php foreach ($level as $k=>$v) :?>
                                            <option value="<?php echo $k ?>" <?php if ($k == $this->input->get('level')): ?>selected="selected"<?php endif?>><?php echo $v ?></option>
                                            <?php endforeach;?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="span6">
                                <div class="control-group">
                                    <label class="control-label">状态</label>
                                    <div class="controls">
                                        <select class="medium m-wrap required" name="status">
                                            <option value="">请选择</option>
                                            <?php foreach (array(1=>'显示', 2=>'不显示') as $k=>$v) :?>
                                            <option value="<?php echo $k ?>" <?php if ($k == $this->input->get('status')): ?>selected="selected"<?php endif?>><?php echo $v ?></option>
                                            <?php endforeach;?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-actions">
                            <button class="btn green" type="submit">搜索</button>
                            <button class="btn reset_button_search" type="button">重置条件</button>
                        </div>
                    </form>
                </div>
            </div>
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption"><i class="icon-reorder"></i>列表</div>
                    <div class="tools">
                        <a class="collapse" href="javascript:;"></a>
                        <a class="remove" href="javascript:;"></a>
                    </div>
                </div>
                <div class="portlet-body flip-scroll">
                    <div class="dataTables_wrapper form-inline">
                        <div class="row-fluid scebery-order-pagination">
                            <span class="dataTables_info">
                                <span>当前第</span><span style="color: red"><?php echo $pg_now;?></span>页 
                                <span>共</span><span style="color: red"><?php echo $all_rows;?></span>条数据
                                <span>每页显示20条 </span>
                                <?php echo $pg_link; ?>
                            </span>
                            <span class="scebery-order-find">
                                <input type="text" name="pg" value="<?php echo isset($pg_now) ? $pg_now :'';?>" class="m-wrap small" placeholder="请输入页数" />
                                <button type="button" class="btn green">确定</button>
                                <button type="button" class="btn green" onclick="window.location.href=localtion.href">刷新</button>
                                <a type="button" class="btn red" href="<?php echo base_url('tourismgoodscategory/add');?>">添加</a>
                            </span>
                        </div>
                        <?php if ($page_list->num_rows() > 0) : ?>
                            <table class="table table-striped table-bordered table-hover">
                                <thead class="flip-content">
                                    <tr>
                                        <th width="15"><input type="checkbox" class="group-checkable" data-set="#sample_1 .checkboxes"></th>
                                        <th>编号</th>
                                        <th>类别名</th>
                                        <th>父级ID</th>
                                        <th>级别</th>
                                        <th>所属类别</th>
                                        <th>上级分类集合</th>
                                        <th>状态</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                <?php foreach ($page_list->result() as $item) : ?>
                                    <tr>
                                        <td><input type="checkbox" class="checkboxes" value="1"></td>
                                        <td><?php echo $item->id; ?></td>
                                        <td><?php echo $item->name ?></td>
                                        <td><?php echo $item->parent_id; ?></td>
                                        <td><?php echo $level[$item->level]; ?></td>
                                        <td><?php echo $item->full_name; ?></td>
                                        <td><?php echo $item->parents; ?></td>
                                        <td><?php echo $item->status==1?'显示':'不显示'; ?></td>
                                        <td style="width:160px">
                                            <a class="btn mini green" href="<?php echo base_url('tourismgoodscategory/edit/'.$item->id); ?>">编辑</a>
                                            <?php if ($item->level == 3): ?>
                                                <!-- 
                                                <a class="btn mini green" href="<?php echo base_url('tourismgoodscategory/delete/'.$item->id) ?>" onclick="return confirm('确定要删除？')"><i class="icon-trash"></i> 删除</a><p></p>
                                                 --><p></p>
                                                <a class="btn mini green" href="<?php echo base_url('tourismgoodscategoryattribute/grid/'.$item->id).'?parent_id='.$item->parent_id; ?>">属性</a>
                                                <a class="btn mini green" href="<?php echo base_url('tourismgoodscategoryadditive/grid?category_id='.$item->id).'?parent_id='.$item->parent_id; ?>">附加属性</a>
                                            <?php endif; ?>
                                        </td>
                                    </tr>
                                <?php endforeach; ?>
                                </tbody>
                            </table>
                            <div class="row-fluid">
                                <div class="span6">
                                    <div class="dataTables_info">
                                        <span>当前第</span><span style="color: red"><?php echo $pg_now ?></span>页
                                        <span>共</span><span style="color: red"><?php echo $all_rows ?></span>条数据
                                        <span>每页显示20条 </span>
                                        <?php echo $pg_link; ?>
                                    </div>
                                </div>
                            </div>
                        <?php else: ?>
                            <div class="alert"><p>未找到数据。<p></div>
                        <?php endif ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
$('.scebery-order-find  button').click(function(){
	var pg = $(this).parents('.scebery-order-find').find('input[name="pg"]').val();
	if (pg.length==0) {
	    return false;
	}
	window.location.href="<?php echo base_url('tourismgoodscategory/grid')?>"+"/"+pg+"<?php echo isset($url) ? $url :'';?>";
})
</script>
<?php $this->load->view('layout/footer'); ?>